import { fontSize } from '@/units'
const colorList = [
  '#5D97FB',
  '#765DFB',
  '#76C3FB',
  '#ACE2D3',
  '#FCB3DA',
  '#A561FF',
  '#FFDA84',
  '#67DBFF',
  '#31D4BD',
  '#B9E89A',
  '#9FACFF',
  '#FFF278',
  '#FF8B8B',
  '#FE769B',
  '#EE84BF',
  '#C2CEFF',
  '#FFBD88',
  '#8AF1B3',
  '#A4C853',
  '#CEFF84',
  '#E4C1FF',
  '#D2D1EE',
  '#7BE4D2',
  '#A4CEFF',
  '#206EF2',
  '#A8EFFF',
]

const Pie1Option = ({ seriesdata }) => {
  return {
    tooltip: {
      trigger: 'item',
      formatter: '{b} : {c} ({d}%)',
      fontSize: fontSize(0.16),
    },
    legend: {
      width: '10%',
      orient: 'vertical',
      right: '2%',
      y: 'center',
      textStyle: {
        color: '#00165D',
        fontFamily: 'SourceHanRegular',
        fontSize: fontSize(0.16),
      },
      icon: 'circle',
      itemStyle: {
        color: 'transparent',
        borderWidth: fontSize(0.04),
        borderColor: '#0ba5ff',
      },
      align: 'left',
      itemGap: fontSize(0.25),
      data: seriesdata.map((item, index) => {
        return {
          value: item.value,
          name: item.name,
          itemStyle: {
            borderColor: colorList[index],
          },
        }
      }),
      inactiveBorderWidth: fontSize(0.05),
      itemHeight: fontSize(0.12),
      itemWidth: fontSize(0.12),
    },
    color: colorList,
    series: [
      {
        name: '',
        type: 'pie',
        radius: ['25%', '80%'],
        center: ['28%', '50%'],
        roseType: 'radius',
        itemStyle: {
          borderRadius: 0,

          //饼状图阴影，值越大阴影亮度越高
          shadowBlur: '10',
          shadowColor: 'rgba(0, 22, 93, .3)',
        },
        label: {
          show: false,
        },
        emphasis: {
          label: {
            show: false,
          },
        },
        data: seriesdata,
      },
    ],
  }
}

export { Pie1Option }
